<div class='_line'></div>
<div class='_cut'></div>
<div id='content'>
<?php foreach($items as $k=>$v){?>
<div class='row'>
    <div class='col-sm-3 col-md-4 full'>
        <div class='thumbnail' style="float:left;width:45%">
            <div style="height:15rem;overflow: hidden;">
                <a target="_blank" href="<?php echo shop_buildUrl('/user/shop/info?item_id='.$v['id']);?>"><img class='_img' src="<?php echo 'http://'.IMAGE_DOMAIN_.$v['images'][0]['image'];?>" style='width:100%;height:100%'/></a>
            </div>
        </div>
        <div class='caption' style='overflow: hidden;float:right;width:53%;height:15rem;'>
            <div>
                <div ><?php echo $v['name'];?></div>
                
                <div ><i>价格：<font style='color:red;font-size:1.7rem'>￥<?php echo $v['price']/100;?></font></i></div>
                <div style='white-space:nowrap;overflow: hidden;'><i>级别：</i>
                <?php $level = json_decode($v['level'],true); foreach($level as $vv){   ?>
                <?php if($vv==1){ $vv= '高级发型师';}elseif($vv==2){ $vv= '高级总监';}elseif($vv==3){ $vv= '高级顾问';}elseif($vv==4){ $vv= '高级美容师';}elseif($vv==5){ $vv=  '高级经理';}elseif($vv==6){ $vv='高级助理';} ?>
                <span style='color:#9D9D9D;' ><?php echo $vv ?> / </span> 
                <?php   } if($v['level']== '0'){  $s='所有'; ?>
                <span style='color:#9D9D9D;' ><?php echo $s ?> / </span>
                <?php } ?>
                </div>
                <div  style='color:#9D9D9D;' >
                    <?php if($v['is_meal_set']==1){  ?> 
                        <?php foreach($v['meal_set_items'] as $kk=>$vv){
                            if($vv['name']==''){
                                continue;
                            }
                            echo '<b>'.$vv['name']."</b>×".$vv['number']."次/个<br/>";
                        }?>
                    <?php }else{  ?>
                        单品
                    <?php }?>
                </div>
                <?php $item_id = $v['id'] ?>
                <div style='float:right;overflow:hidden;position:absolute;top:13rem;right:1rem;'>
                    <a href="javascript:;" onclick='addin(<?php echo $item_id?>)' ><img src="/public/images/cart.png" ></a>
                </div>
            </div>
        </div>
    </div>
 
</div>
<?php }?>
</div>
<div class='_line'></div>

<script type="text/javascript">
    function addin(item_id){
        session = "<?php  echo $_SESSION['client_id'];?>";
        store_id = "<?php  echo (int)$_GET['store_id']; ?>";
        /*if(session<1){
            window.location.href = "/user/passport/login?store_id="+store_id;
        }*/
        $.ajax({
            url:"<?php echo shop_buildUrl('/user/shop/addin?item_id="+item_id+"');?>",async:true, 
            success: function(msg){
                if(msg == 'false'){
                    alert('添加失败！');
                    return;
                }
                if(msg== 1){
                    alert('添加成功！');
                }
            }
        });        
    }
</script>